package com.biye.api.controller.other;

import com.biye.api.tool.rabbitmqSubscribe.dao.HuoDongCourseInput;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.handler.annotation.Header;
import org.springframework.stereotype.Service;

@EnableBinding({HuoDongCourseInput.class})  // HuoDongCourseInput重写Sink.class
@Service
public class MessageSubscribeController {

    @StreamListener(value = HuoDongCourseInput.INPUT, condition = "headers['version']=='1.0'")
    public void receiver1(String payload, @Header("version") String version){
        System.out.println("1==>" + payload);
    }

    @StreamListener(value = HuoDongCourseInput.INPUT, condition = "headers['version']=='2.0'")
    public void receiver2(String payload, @Header("version") String version){
        System.out.println("2==>" + payload);
    }


}
